package com.thghh;

import com.thghh.table.ElegantTableModel;

import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        final int WIDTH = 700;
        final int HEIGHT = 500;
        final int USER_SIZE = 10;

        final JFrame frame = new JFrame();
        frame.setTitle("基于面向对象的TableModel测试");
        frame.setSize(WIDTH, HEIGHT);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        final JTable table = new JTable();
        table.setFillsViewportHeight(true);
        table.setRowHeight(30);
        List<HandshakeBean> dataList = new ArrayList<>();

        for (int i = 0; i < 100; i++) {
            HandshakeBean data = new HandshakeBean();
            data.setIsSelect(false);
            data.setSerialNumber(i);
            data.setProjectId("CX" + i);
            data.setSubSystemId("Sys id" + i);
            data.setSubSystemName("sys name" + i);
            data.setFirstLevelAtt("fir" + i);
            data.setSecondLevelAtt("Sec" + i);
            data.setObjectName("BX" + i);
            data.setRequirementId(Math.random() + "");
            data.setHandShakeApprove("同意");
            data.setHandShakeStatus("Reject");
            data.setPssEngineer("pss" + i);
            data.setHandShakeTime("time" + i);
            dataList.add(data);
        }

        HandshakeTableModel dataModel = new HandshakeTableModel(dataList);

        table.setModel(dataModel);

        frame.add(new JScrollPane(table));

        frame.setVisible(true);
    }


}
